package invoker;

import IA.CookItem;
import IA.InformationAggregator;
import IA.WaitingParty;
import commands.*;
import java.util.Iterator;

/**
 *
 * @author Christopher
 */
public class Invoker {

    InformationAggregator ia;

    public Invoker(InformationAggregator ia) {
        this.ia = ia;
    }

    public void addComment(String comment) {
        CmdAddComment command = new CmdAddComment(ia, comment);
        command.execute();
    }

    public Object getComments() {
        CmdGetComments command = new CmdGetComments(ia);
        return command.execute();
    }

    public void approveComment(String comment) {
        CmdApproveComment command = new CmdApproveComment(ia, comment);
        command.execute();
    }

    public void removeComment(String indexStr) {
        CmdRemoveComment command = new CmdRemoveComment(ia, indexStr);
        command.execute();
    }

    public Object browseMenu() {
        CmdBrowseMenu command = new CmdBrowseMenu(ia);
        return command.execute();
    }

    public Object browseMenuByPrice(String priceStr) {
        CmdBrowseMenuByPrice command = new CmdBrowseMenuByPrice(ia, priceStr);
        return command.execute();
    }

    public Object browseMenuByRating(String ratingStr) {
        CmdBrowseMenuByRating command = new CmdBrowseMenuByRating(ia, ratingStr);
        return command.execute();
    }


    public void adjustPrepTime(String prepStr) {
        CmdAdjustPrepTime command = new CmdAdjustPrepTime(ia, prepStr);
        command.execute();
    }

    public void addItem(String itemStr) {
        CmdAddItem command = new CmdAddItem(ia, itemStr);
        command.execute();
    }

    public void removeItem(String itemStr) {
        CmdRemoveItem command = new CmdRemoveItem(ia, itemStr);
        command.execute();
    }


    public Object getTableStatus(int TableID) {
        CmdGetTableStatus command = new CmdGetTableStatus(ia, TableID);
        return command.execute();
    }

    public Object addItemComment(String commentStr) {
        CmdAddItemComment command = new CmdAddItemComment(ia, commentStr);
        return command.execute();
    }

    public Object removeItemComment(String commentStr) {
        CmdRemoveItemComment command = new CmdRemoveItemComment(ia, commentStr);
        return command.execute();
    }

    public Object getItemComments(String indexStr) {
        CmdGetItemComments command = new CmdGetItemComments(ia, indexStr);
        return command.execute();
    }

    public Object setNumberOfTables(String totalNumOfTables) {
        CmdSetNumberOfTables command = new CmdSetNumberOfTables(ia, totalNumOfTables);
        command.execute();
        return null;
    }

    public Object getNumberOfTables() {
        CmdgetNumberOfTables command = new CmdgetNumberOfTables(ia);
        return command.execute();
    }

    public Object GetMostLeastOrdered() {
        CmdGetMostLeastOrdered command = new CmdGetMostLeastOrdered(ia);
        return command.execute();
    }

    public int getCustomersAtTable(int TableIndex) {
        return (Integer) new CmdGetCustomersAtTable(ia, TableIndex).execute();
    }

    public int getOrdersAtTable(int TableID) {
        return (Integer) new CmdGetNumberOfOrders(ia, TableID).execute();
    }

    public Integer getNumberOfWaitingCustomers() {
        return new CmdGetNumberOfCustomersWaiting(ia).execute();
    }

    public Iterator<CookItem> getKitchenQueueIterator() {
        return new CmdGetKitchenQueueIterator(ia).execute();
    }

    public Iterator<CookItem> getGrillIterator() {
        return new CmdGetGrillIterator(ia).execute();
    }

    public Iterator<WaitingParty> getCustomerQueueIterator() {
        return new CmdGetCustomerQueueIterator(ia).execute();
    }

    public String getAverageCustomerWaitingTime() {
        return new CmdGetAverageWaitingTime(ia).execute();
    }

    public Integer getTotalNumCustomers() {
        return new CmdGetTotalNumCustomers(ia).execute();
    }

    public String getFoodStatus(int TableID) {
        return new CmdGetFoodStatus(ia, TableID).execute();
    }

    public String getAverageCookDeliveryTime() {
       return new CmdGetAverageCookDeliveryTime(ia).execute();
    }

    public String getAveragePrepTime() {
        return new CmdGetAveragePrepTime(ia).execute();
    }
} // end class Invoker